<template>
  <div class="dada">
    <!-- 头部 -->
    <div style="margin: auto; width: 57px">
      <van-image class="login-img" width="100%" src="/login_img/dl-logo.png" />
    </div>
    <!-- 头像 -->
    <div class="xiao">
      <!-- <van-cell center title="头像" class="cell celltext" size="large">
        <van-image
          class="top"
          round
          width="3.5rem"
          height="3.5rem"
          src="/me_img/head_portrait.jpg"
        />
      </van-cell> -->
      <!-- 昵称 -->
      <van-form @submit="onSubmit">
        <van-field
          class="cell"
          v-model="username"
          label="昵称"
          input-align="right"
          placeholder="请填写昵称"
        />

        <!-- 性别 -->
        <div class="from_item">
          <van-cell
            title="性别"
            input-align="right"
            :value="formData.sex || '请选择性别'"
            @click="showsexPopup = true"
          />
        </div>
        <!-- 邮箱 -->
        <van-field
          class="cell"
          v-model="phone"
          label="手机号"
          type="number"
          input-align="right"
          placeholder="请填写手机号"
          disabled
        />
        <!-- 邮箱 -->
        <van-field
          class="cell"
          v-model="email"
          label="邮箱"
          input-align="right"
          placeholder="请填写邮箱"
          disabled
        />
        
        <van-popup v-model="showsexPopup" position="bottom">
          <van-picker
            show-toolbar
            title="性别"
            :columns="columns"
            @cancel="onCancel"
            @confirm="onConfirm"
          />
        </van-popup>
        <!-- 按钮 -->
        <div style="margin: 30px 16px">
          <van-button round block type="info" native-type="submit"
            >提交</van-button
          >
        </div>
      </van-form>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      username: '',
      phone: '',
      email: '',
      formData: {
        sex: '',
      },
      columns: ['男', '女'],
      showsexPopup: false,
      value: '',
    }
  },
  methods: {
    onSubmit(values) {
      console.log('submit', values)
    },
    onConfirm(value) {
      this.formData.sex = value
      this.showsexPopup = false
    },
    onCancel() {
      this.showsexPopup = false
    },
  },
}
</script>

<style scoped>
#dl {
  margin-top: 35%;
}
.dada {
  background: #f7f7f7;
  height: 100vh;
  padding-top: 15%;
}
.cell {
  margin-bottom: 15px;
}
.xiao {
  padding-top: 15%;
}
</style>
